import { axios } from '@/utils/request'

const api = {
  consultGetList: '/admin/information/pageList',
  consultAdd: '/admin/information/save',
  consultEdit: '/admin/information/update',
  consultDel: '/admin/information/remove',
  getModuleList: '/admin/information/getModule',

  informationCategoryList: '/admin/informationCategory/list',
  informationCategoryListByLevel: '/admin/informationCategory/listByLevel',
  informationCategory: '/admin/informationCategory',
  memberLevelList: '/admin/member/memberLevelList',
  informationCategoryDetail: '/admin/informationCategory/get',
  informationDtail:'admin/information/get'
}

export default api

/**
  * 资讯列表
  */
export function consultGetList(params) {
  return axios({
    url: api.consultGetList,
    method: 'get',
    params
    // : {
    //   ...params,
    //   size: 10,
    //   pageNum: undefined,
    //   pageSize: undefined
    // }
  })
}

/**
* 咨询管理新增
*/
export function consultAdd(data) {
  return axios({
    url: api.consultAdd,
    method: 'post',
    data
  })
}

/**
* 资讯管理编辑
*/
export function consultEdit(data) {
  return axios({
    url: api.consultEdit,
    method: 'post',
    data
  })
}

/**
* 资讯管理删除
*/
export function consultDel(data) {
  return axios({
    url: api.consultDel,
    method: 'post',
    data
  })
}
/**
* 导航模块
*/
export function getModuleList(params) {
  return axios({
    url: api.getModuleList,
    method: 'get',
    params
  })
}

//获取资讯分类列表
export function informationCategoryList() {
  return axios({
    url: api.informationCategoryList,
    method: 'get'
  })
}

//根据职务获取资讯分类列表 (默认一级)
export function informationCategoryListByLevel() {
  return axios({
    url: api.informationCategoryListByLevel,
    method: 'get'
  })
}

//添加分类
export function addInformationCategory(data) {
  return axios({
    url: api.informationCategory,
    method: 'post',
    data
  })
}

//修改分类
export function editInformationCategory(data) {
  return axios({
    url: api.informationCategory,
    method: 'put',
    data
  })
}

//删除分类
export function delInformationCategory(id) {
  return axios({
    url: api.informationCategory + `/${id}`,
    method: 'delete'
  })
}

/**
* 会员等级列表
*/
export function getMemberLevelList() {
  return axios({
    url: api.memberLevelList,
    method: 'get',
  })
}


/**
 * 获取分类详情
 * @param {*} params 
 * @returns 
 */
export function getInformationCategoryDetail(params) {
  return axios({
    url: api.informationCategoryDetail,
    method: 'get',
    params
  })
}

/**
 * 获取咨询详情
 * @param {*} id 
 * @returns 
 */
export function getInformationDtail(id) {
  return axios({
    url: api.informationDtail+'/'+id,
    method: 'get',
  })
}
/**
 * 获取链接
 * @param {*} data 
 * @returns 
 */
export function generateUrlLink(data) {
  return axios({
    url: `/admin/systemLink/generateUrlLink`,
    method: 'post',
    data
  })
}

